package controllers;

import exceptions.NoUUIDException;
import interceptors.AuthCheckInterceptor;
import interceptors.DefaultInterceptor;
import interceptors.UserSessionInterceptor;
import play.mvc.Controller;
import play.mvc.Result;
import play.mvc.With;
import services.UserService;
import util.UserSession;

@With({DefaultInterceptor.class, UserSessionInterceptor.class, AuthCheckInterceptor.class})
public class Focus extends Controller{
	
	private static final UserService userService = UserService.getInstance();

	public static Result index() {
		try {
			UserSession userSession = userService.getUserSession(session());
			return ok(views.html.focus.render(userSession));
		} catch (NoUUIDException e) {
			e.printStackTrace();
			return unauthorized();
		}
    }
}
